<?php

abstract class HTML_Fluent_XHTML_Element_Base_TR extends HTML_Fluent_Element {

    /**
     * The name of this element
     *
     * @return string
     */
    public function getName() {
        return 'tr';
    }

    protected $attributes = array(
        'align' => null,
        'char' => null,
        'charoff' => null,
        'class' => null,
        'dir' => null,
        'id' => null,
        'lang' => null,
        'onclick' => null,
        'ondblclick' => null,
        'onkeydown' => null,
        'onkeypress' => null,
        'onkeyup' => null,
        'onmousedown' => null,
        'onmousemove' => null,
        'onmouseout' => null,
        'onmouseover' => null,
        'onmouseup' => null,
        'style' => null,
        'title' => null,
        'valign' => null,
    );

    /**
     * Add a new element 'td' as a child
     *
     * @return HTML_Fluent_XHTML_Element_TD
     */
    public function td() {
        return $this->newChildElement('td', func_get_args());
    }

    /**
     * Add a new element 'th' as a child
     *
     * @return HTML_Fluent_XHTML_Element_TH
     */
    public function th() {
        return $this->newChildElement('th', func_get_args());
    }


    /**
     * Set the value of the 'align' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function align($value) {
        return $this->setAttribute('align', $value);
    }

    /**
     * Set the value of the 'char' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function char($value) {
        return $this->setAttribute('char', $value);
    }

    /**
     * Set the value of the 'charoff' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function charoff($value) {
        return $this->setAttribute('charoff', $value);
    }

    /**
     * Set the value of the 'class' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function c($value) {
        return $this->setAttribute('class', $value);
    }

    /**
     * Add a class name to the class attribute.
     *
     * @param string $class
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function addClass($class) {
        $classes = array_unique(preg_split('/\s+/', $this->getAttribute('class'), -1, PREG_SPLIT_NO_EMPTY));
        $classes[] = $class;
        return $this->setAttribute('class', implode(' ', $classes));
    }

    /**
     * Remove a class name from the class attribute.
     *
     * @param string $class
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function removeClass($class) {
        $classes = array_unique(preg_split('/\s+/', $this->getAttribute('class'), -1, PREG_SPLIT_NO_EMPTY));
        foreach ($classes as $key => $value) {
            if ($value == $class) unset($classes[$key]);
        }
        return $this->setAttribute('class', implode(' ', $classes));
    }

    /**
     * Set the value of the 'dir' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function dir($value) {
        return $this->setAttribute('dir', $value);
    }

    /**
     * Set the value of the 'id' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function id($value) {
        return $this->setAttribute('id', $value);
    }

    /**
     * Set the value of the 'lang' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function lang($value) {
        return $this->setAttribute('lang', $value);
    }

    /**
     * Set the value of the 'onclick' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function onclick($value) {
        return $this->setAttribute('onclick', $value);
    }

    /**
     * Set the value of the 'ondblclick' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function ondblclick($value) {
        return $this->setAttribute('ondblclick', $value);
    }

    /**
     * Set the value of the 'onkeydown' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function onkeydown($value) {
        return $this->setAttribute('onkeydown', $value);
    }

    /**
     * Set the value of the 'onkeypress' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function onkeypress($value) {
        return $this->setAttribute('onkeypress', $value);
    }

    /**
     * Set the value of the 'onkeyup' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function onkeyup($value) {
        return $this->setAttribute('onkeyup', $value);
    }

    /**
     * Set the value of the 'onmousedown' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function onmousedown($value) {
        return $this->setAttribute('onmousedown', $value);
    }

    /**
     * Set the value of the 'onmousemove' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function onmousemove($value) {
        return $this->setAttribute('onmousemove', $value);
    }

    /**
     * Set the value of the 'onmouseout' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function onmouseout($value) {
        return $this->setAttribute('onmouseout', $value);
    }

    /**
     * Set the value of the 'onmouseover' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function onmouseover($value) {
        return $this->setAttribute('onmouseover', $value);
    }

    /**
     * Set the value of the 'onmouseup' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function onmouseup($value) {
        return $this->setAttribute('onmouseup', $value);
    }

    /**
     * Set the value of the 'style' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function style($value) {
        return $this->setAttribute('style', $value);
    }

    /**
     * Set the value of the 'title' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function title($value) {
        return $this->setAttribute('title', $value);
    }

    /**
     * Set the value of the 'valign' attribute.
     *
     * @param string|null $value
     * @return HTML_Fluent_XHTML_Element_TR
     */
    public function valign($value) {
        return $this->setAttribute('valign', $value);
    }

}
